package com.hdax.gulimall.order.feign;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.hdax.common.utils.R;
import com.hdax.gulimall.order.vo.SkuHasStockVo;
import com.hdax.gulimall.order.vo.WareSkuLockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("gulimall-ware")
public interface WmsFeignService {

    @PostMapping("/ware/waresku/hasStock")
    R<List<SkuHasStockVo>> getSkuHasStock(@RequestBody List<Long> skuIds);


    /**
     * 获取运费信息(根据地址的id查询)
     * @param id
     * @return
     * @throws JsonProcessingException
     */
    @GetMapping("/ware/wareinfo/fare")
     R  getFare(@RequestParam("addrId") Long id) throws JsonProcessingException;


    /**
     * 为订单锁定库存
     * @param wareSkuLockVo
     * @return
     */
    @PostMapping("/ware/waresku/lock/order")
    R orderLockStock(@RequestBody WareSkuLockVo wareSkuLockVo);

}
